package com.luobo.home.utils;

import com.luobo.home.pojo.Items;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ListPojoToListMap {


    public static List<Map<String, Object>> createItemsMap(List<Items> items) {

        List<Map<String, Object>> resultList = new ArrayList<>();

        int i = 1;
        for (Items tempitems:
                items) {
            Map<String,Object> resultMap = new HashMap<>();
            resultMap.put("id",i++);
            resultMap.put("itemId",tempitems.getItemId());
            resultMap.put("itemName",tempitems.getItemName());
            resultMap.put("itemAmount",tempitems.getItemAmount());
            resultMap.put("itemUrllist",tempitems.getItemUrllist().split(","));
            resultMap.put("itemCategroy",tempitems.getItemCategroy());
            resultMap.put("itemOvertime",tempitems.getItemOvertime());
            resultMap.put("itemStatus",tempitems.getItemStatus());
            resultMap.put("itemUse",tempitems.getItemUse());
            resultMap.put("itemPosition",tempitems.getItemPosition());
            resultMap.put("positionUrllist",tempitems.getPositionUrllist()!=null?tempitems.getPositionUrllist().split(","):null);
            resultMap.put("remark",tempitems.getRemark());

            resultList.add(resultMap);
        }

        return resultList;

    }

}
